{{- $context := . }}
{{- range $crd := $context.Values.userAuthn.internal.dexUsersCRDs }}
{{ $pass := $crd.spec.password }}
{{- if hasPrefix "$2" $pass }}
{{ $pass = $pass | b64enc }}
{{- end }}
---
apiVersion: dex.coreos.com/v1
kind: Password
metadata:
  name: {{ $crd.encodedName }}
  namespace: d8-{{ $context.Chart.Name }}
  {{- include "helm_lib_module_labels" (list $context (dict "app" "dex")) | nindent 2 }}
email: {{ $crd.spec.email | lower | quote }}
hash: {{ $pass | quote }}
username: {{ $crd.name | quote }}
userID: {{ $crd.name | quote }}
  {{- if $crd.spec.groups }}
groups:
{{- range $group := $crd.spec.groups }}
- {{ $group }}
{{- end }}
  {{- end }}
{{- end }}
